import request from '@/config/axios'

// 分组 VO
export interface GroupVO {
  id: number // 序号
  name: string // 名称
  code: string // 编码
  enable: boolean // 启用
}

// 分组 API
export const GroupApi = {
  // 查询分组分页
  getGroupPage: async (params: any) => {
    return await request.get({ url: `/forward/group/page`, params })
  },

  // 查询分组详情
  getGroup: async (id: number) => {
    return await request.get({ url: `/forward/group/get?id=` + id })
  },

  // 新增分组
  createGroup: async (data: GroupVO) => {
    return await request.post({ url: `/forward/group/create`, data })
  },

  // 修改分组
  updateGroup: async (data: GroupVO) => {
    return await request.put({ url: `/forward/group/update`, data })
  },

  // 删除分组
  deleteGroup: async (id: number) => {
    return await request.delete({ url: `/forward/group/delete?id=` + id })
  },

  // 导出分组 Excel
  exportGroup: async (params) => {
    return await request.download({ url: `/forward/group/export-excel`, params })
  },

// ==================== 子表（分组权限） ====================

  // 获得分组权限列表
  getGroupAclListByGroupId: async (groupId) => {
    return await request.get({ url: `/forward/group/group-acl/list-by-group-id?groupId=` + groupId })
  },
}